package com.leolian.spring01.beanannotation.multibean;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component("invoke")
public class BeanInvoker {
	@Autowired
	private List<BeanInterface> list;
	
	@Autowired
	private Map<String,BeanInterface> map;
	
	@Qualifier("beanImplTwo")
	@Autowired
	public BeanInterface bean;
	
	//遍历list
	public void list(){
		if(null!=list && list.size()!=0){
			for (BeanInterface beanInterface : list) {
				System.out.println(beanInterface.getClass().getName());
			}
		}else{
			System.out.println("List  is  empty ...");
		}
	}
	
	//遍历map
	public void map(){
		if(null!=map && map.size()!=0){
			for (Map.Entry<String, BeanInterface> entry : map.entrySet()) {
				System.out.println(entry.getKey()+" --- "+entry.getValue());
			}
		}else{
			System.out.println("Map  is  empty ...");
		}
	}
	
	//bean
	public void bean(){
		if(null!=bean){
			System.out.println(bean.getClass().getName());
		}else{
			System.out.println("Bean  is  empty...");
		}
	}
	
}
